<template>
  <div>
    <div width="100px">
    <el-input v-model="districtHospital" placeholder="请输入省市进行搜索" 
    maxlength="20" show-word-limit
    style="width: 400px;"></el-input>
    <el-button @click="selHospital()">搜索</el-button>
    </div>
      <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="dhospital" label="可签约医院名称" width="300">
      </el-table-column>
      <el-table-column prop="daddress" label="医院地址" width="300">
      </el-table-column>
      <!-- <el-table-column prop="dnum" label="可签约医生数量" width="300">
      </el-table-column> -->
      <el-table-column label="操作" width="200">
        <template slot-scope="scope">
          <el-button @click="signTeam(scope.row)">签约该医院</el-button>
        </template >
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  mounted() {
    this.updateTable();
  },
  data() {
    return {
      districtHospital:"湖南省长沙市",
      tableData: [],
      dialogFormVisible: false,
      form: {
        pname: "",
        pcard: "",
        page: "",
        paddress: "",
        psex: "",
        ptel: "",
        pbirthday: "",
        pimage: "",
      },
      formLabelWidth: "120px",
    };
  },
  methods: {
    updateTable() {
          let pid=JSON.parse(sessionStorage.getItem("pat")).pid;
          this.$axios.post("patient-serv/patientinfo/selLocalDistrictHospital/"+pid).then((response) => {
          let r = response.data;
          this.tableData=r.data;
        });
    },
    selHospital() {
          let districtHospital=this.districtHospital;
          this.$axios.post("patient-serv/patientinfo/selHospital/"+districtHospital).then((response) => {
          let r = response.data;
          this.tableData=r.data;
        });
    },
        updateUI(row) {
      this.dialogFormVisible = true;
      // 回显数据
      this.form = row;
    },
    signTeam(row) {
       let info = JSON.stringify(row.dhospital);
       sessionStorage.setItem("dhospital", info);
       this.$router.push("/Pat_signTeam");
    },
  }
};
</script>

<style>

</style>